package com.ruoyi.flowable.rpc;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * system rpc接口调用
 */
@FeignClient(value = ServiceNameConstants.SYSTEM_SERVICE)
public interface IRemoteSystemService {

    @GetMapping("/rpc/user/list")
    R<List<SysUser>> getUsers(@RequestParam Map<String, Object> paraMap, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/user/{userId}")
    R<SysUser> getUserById(@PathVariable(value = "userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/role/list")
    R<List<SysRole>> getRoles(@RequestParam Map<String, Object> paraMap, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/role/{roleId}")
    R<SysRole> getRoleById(@PathVariable(value = "roleId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
